Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add logging for unsupported types present when generating to/from methods #85

Merged
merged 9 commits into from
Nov 7, 2023

Conversation

bendbennett
Copy link
Contributor

Closes: #84

This PR modifies the handling of code generation for To<...>()/From<...>() methods. Refer to #84 for details.

If a spec contains an unsupported type during the generation of To<...>()/From<...>() methods, the To<...>()/From<...>() methods are not generated, and an error is raised and logged.

For example, the following spec, which contains a list attribute, with an element type that is also a list:

{
  "version": "0.1",
  "datasources": [
    {
      "name": "datasource",
      "schema": {
        "attributes": [
          {
            "name": "list_attribute",
            "list": {
              "associated_external_type": {
                "import": {
                  "path": "github.com/api"
                },
                "type": "*api.ListAttribute"
              },
              "computed_optional_required": "required",
              "element_type": {
                "list": {
                  "element_type": {
                    "bool": {}
                  }
                }
              }
            }
          }
        ]
      }
    }
  ],
  "provider": {
    "name": "provider"
  }
}

Now results in the generation of the following log message:

time=2023-11-06T09:28:39.958Z level=ERROR msg="error generating to/from methods" path=data_source.datasource.list_attribute. err="list element type is not yet implemented"

@bendbennett bendbennett added the enhancement New feature or request label Nov 6, 2023
@bendbennett bendbennett requested a review from a team as a code owner November 6, 2023 09:32
Copy link
Member

@austinvalle austinvalle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! lgtm 🚀 🚀

@bendbennett bendbennett merged commit b66db47 into main Nov 7, 2023
4 checks passed
@bendbennett bendbennett deleted the bendbennett/issues-84 branch November 7, 2023 07:32
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add logging for unsupported types present when generating to/from methods
2 participants